package com.cqh.recruit.controller.school;


import com.cqh.recruit.pojo.dto.EmployeeLoginDTO;
import com.cqh.recruit.pojo.entity.LoginInfo;
import com.cqh.recruit.result.Result;
import com.cqh.recruit.service.IEmployeeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:
 * @Author: DengHao
 * @Date: 2025/10/18 10:14
 */
@RestController
@RequestMapping("/api/school/empLogin")
@Tag(name = "员工登录接口")
public class EmployeeLoginController {
    @Autowired
    private IEmployeeService employeeService;

    /**
     * 员工登录
     * @param employeeLoginDto
     * @return
     */
    @Operation(summary = "员工登录")
    @PostMapping("/login")
    public Result login(@RequestBody EmployeeLoginDTO employeeLoginDto){
        LoginInfo info=employeeService.login(employeeLoginDto);
        if (info == null) {
            return Result.buildFail(40001, "用户名或密码错误!");
        }
        return Result.buildSuccess(info);
    }
}
